__author__ = 'amin'
import Core.parser
import Core.Canvas
f = Core.parser.Parser("example2.fea").process()
l=[]
for i in f:
    if i.type=="data":
        l.append(i)

l_d=[]
for j in l:
    d = {}
    x = open(j.name+".int" ,"r")
    for i in x:
        i.strip("\n")
        k = i.split("\t")
        if j.strand=="d":
            d.update({int(k[1]):float(k[4])/j.width})
        elif j.strand=="nd":
            d.update({int(k[1]):-1 * float(k[4])/j.width})
        elif j.strand=="m":
            d.update({int(k[1]):float(k[4])*j.width})

    l_d.append([j.name,d])

Core.Canvas.DrawCanvas(f, l_d, 900,len(l_d) * 200)


